<h2>ajax2.js</h2>
<p>Provides basic asynchronous xml call (AJAX) routines.</p>

<strong style="color:#f00">THIS IS THE NEW VERSION OF API. YOU CAN STIL USE THE OLD ONE (ajax.js), BUT IT IS OBSOLETE AND UNSUPPORTED. 
YOU SHOULD SWITCH TO THIS INTERFACE ASAP.
</strong>

<hr/>

<h3>Functions</h3>
<ul>
	<li><a href="#method">OAT.AJAX.[METHOD](url, data, callback, options)</a></li>
	<li><a href="#abortall">OAT.AJAX.abortAll()</a></li>
</ul>

<h3>Valid method names</h3>
<ul>
	<li>GET</li>
	<li>POST</li>
	<li>SOAP</li>
	<li>PUT</li>
	<li>MKCOL</li>
	<li>PROPFIND</li>
	<li>PROPPATCH</li>
</ul>

<h3>Properties</h3>
<ul>
	<li><a href="#startref">OAT.AJAX.startRef</a></li>
	<li><a href="#endref">OAT.AJAX.endRef</a></li>
</ul>

<h3>Constants</h3>
<ul>
	<li>OAT.AJAX.AUTH_BASIC</li>
	<li>OAT.AJAX.AUTH_BASIC</li>
	<li>OAT.AJAX.AUTH_DIGEST</li>
	<li>OAT.AJAX.TYPE_TEXT</li>
	<li>OAT.AJAX.TYPE_XML</li>
</ul>

<h3>Messages</h3>
<ul>
	<li>OAT.MSG.AJAX_START</li>
	<li>OAT.MSG.AJAX_ERROR</li>
</ul>

<hr/>

<h3><a name="method">OAT.AJAX.[METHOD](url, data, callback, options)</a></h3>
<p>Sends an HTTP request to a page <em>url</em>. Data to be contained in request are specified in <em>data</em>. 
When response arrives, <em>callback(response)</em> will be executed. You may specify the following <em>options</em>:</p>
<ul>
	<li>type - response format, one of TYPE_ constants</li>
	<li>auth - authorization type, one of AUTH_ constants</li>
	<li>async - bool</li>
	<li>noSecurityCookie - bool, forbids sending a security cookie & corresponding GET parameter</li>
	<li>user, password - credentials for http authorization</li>
	<li>headers - JS object containing additional headers to be sent</li>
	<li>onerror - callback to be executed when error occurs</li>
	<li>onstart - callback to be executed when call launches</li>
	<li>onend - callback to be executed when call finishes, independently on success/error</li>
</ul>
<p style="color:#f00">To prevent JavaScript hijacking attacks, 
web application authors are encouraged to use some of the countermeasures described in 'security' part of the documentation.</p>

<pre class="code">
var options = {
	user:"username",
	password:"top_secret",
	auth:OAT.AJAX.AUTH_BASIC,
	onerror:function(request) { alert(request.getStatus()); }
}
var callback = function(data) { alert(data); };
OAT.AJAX.GET("/myfile.xml", false, callback, options);
</pre>

<h3><a name="abortall">OAT.AJAX.abortAll()</a></h3>
<p>Cancels all pending requests.</p>

<h3><a name="startref">OAT.AJAX.startRef</a></h3>
<p>Here you can give a function to be executed when a request is being sent.</p>

<h3><a name="endref">OAT.AJAX.endRef</a></h3>
<p>Here you can give a function to be executed when all requests were satisfied (or cancelled).</p>

